package com.wuliu.driver.controller;

import com.wuliu.driver.pojo.Bill;
import com.wuliu.driver.service.BillService;
import com.wuliu.driver.service.BillServiceImpl;
import com.wuliu.driver.util.Code;
import com.wuliu.driver.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/bill")
public class BillController {

    @Autowired
    private BillService billService;


    @RequestMapping("/selectAll/{did}")
    public Result selectAll(@PathVariable Integer did){
        List<Bill> bills = billService.selectAll(did);
        System.out.println(bills);
        if (bills.size()>0){
            return new Result(Code.GET_OK,bills,"获取成功");
        }else {
            return new Result(Code.GET_ERR,"获取失败");
        }
    }
}
